﻿namespace TestingBindings
{
    using Caliburn.Testability;
    using Commands;
    using NUnit.Framework;
    using NUnit.Framework.SyntaxHelpers;

    /// <summary>
    /// Note that we are referencing the WPF assemblies as well as Caliburn.
    /// Also, we have to run our tests STA! Notice the config file.
    /// </summary>
    [TestFixture]
    public class The_view_for_the_registration_form : BindingsTestBase
    {
        private readonly ValidationResult<RegistrationController> bindings;

        public The_view_for_the_registration_form()
        {
            bindings = Validator.For<RegistrationView, RegistrationController>()
                .Validate();
        }

        [Test]
        public void does_not_have_binding_errors()
        {
            Assert.That(bindings.HasErrors, Is.False, bindings.ErrorSummary);
        }

        [Test]
        public void is_bound_to_the_register_command()
        {
            Assert.That(bindings.WasBoundTo(x => x.RegisterCommand));
        }
    }
}